package com.azzcs.codeservicealibaba.controller;

import com.azzcs.codeservicecore.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: wzg
 * @Date: 2021/2/22 下午3:27
 */
@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;

    @GetMapping("/create/{email}")
    public Integer createCode(@PathVariable("email") String email){
        return codeService.createCode(email);
    }

    @PostMapping("/check")
    public Boolean checkCode(@RequestParam("email") String email,
                             @RequestParam("code")Integer code){
        return codeService.checkCode(email,code);
    }
}
